#pragma once


// CDlgSetup dialog

class CDlgSetup : public CDialog
{
	DECLARE_DYNAMIC(CDlgSetup)
public:
	CBitmap			m_Skin;
	CString			m_folderPath;
	CHotSpots		m_buttons;
	CHotSpots		m_radRec;
	CHotSpots		m_radQua;
	CHotSpots		m_radFrmRun;
	CHotSpots		m_radFrmStop;
	CHotSpots		m_radPmode;
	CHotSpots		m_radNight;
	CHotSpots		m_radVidPos;
	CHotSpots		m_radAudio;
	CThumbScroll	m_SliderGSensRun;
	CThumbScroll	m_SliderGSensStop;
	CThumbScroll	m_SliderMSens;
	CThumbScroll	m_SliderAudioVol;

	int				m_radRecIdx;
	int				m_radQuaIdx;
	int				m_radFrmRunIdx;
	int				m_radFrmStopIdx;
	int				m_radPmodeIdx;
	int				m_radNightIdx;
	int				m_radVidPosIdx;
	int				m_radAudioIdx;
	int				m_SliderGSensRunIdx;
	int				m_SliderGSensStopIdx;
	int				m_SliderMSensIdx;
	int				m_SliderAudioVolIdx;

	HOTSPOT			m_hsBtns[30];
	HOTSPOT			m_hsRadRec[2];
	HOTSPOT			m_hsRadQua[3];
	HOTSPOT			m_hsRadFrmRun[3];
	HOTSPOT			m_hsRadFrmStop[3];
	HOTSPOT			m_hsRadPmode[3];
	HOTSPOT			m_hsRadNight[3];
	HOTSPOT			m_hsRadVidPos[2];
	HOTSPOT			m_hsRadAudio[2];

	CRect			m_rcWin4Resizing;
	int				m_resizingStatus;		//0: none, SKIN_XMOVE ~ SKIN_YEXTEND
	POINT			m_ptDrag;

public:
	BOOL			loadVersion();
	BOOL			loadConfig();
	void			saveConfig();
	void			saveTimeSet();
	void			resetConfig();
	void			cancelConfig();
	void			formatMemory();
	void			init();
	void			prepareSkin();
	void			setBtnPos();
	void			setSliderPos();
	void			displaySkin(CDC* pDC);

public:
	CDlgSetup(LPCTSTR folderPath, CWnd* pParent = NULL);   // standard constructor
	virtual ~CDlgSetup();

protected:
	void			init_buttons(CHotSpots* pCHotSpot, BTN_FACTOR* btn_factors, HOTSPOT* hotspots, int count);
	void			init_sliders(CThumbScroll* pTh, CRect* rcSliders, int idbThumb[],
								 int idbPad, COLORREF rgbSlits[], int dir, long maxPos);


// Dialog Data
	enum { IDD = IDD_DLG_SETUP };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnPaint();
	virtual BOOL OnInitDialog();
protected:
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
public:
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnDestroy();
};
